<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<link href="/assets/css/menubase.css" rel="stylesheet" type="text/css" />
</h:head>
<h:body>
	<h:form id="roleManagerForm">
		<p:commandButton value="刷新" id="ajax" update="roleList"
			actionListener="#{roleController.generateRoleList()}"
			styleClass="margin-left:10px" />
		<p:commandButton value="添加" update="roleList"
			actionListener="#{roleController.addRole()}" style="margin-left:10px" />
		<p:separator></p:separator>
		<p:dataTable id="roleList" var="role"
			value="#{roleController.roleCurrents}" rowKey="#{role.id}"
			editable="true" style="margin-left:10px">
			<!-- <f:facet name="header">角色信息</f:facet> -->
			<p:ajax event="rowEdit"
				listener="#{roleController.onCreateOrEditRole}" />
			<p:ajax event="rowEditCancel" />
			<p:column headerText="名称">
				<h:inputHidden value="#{role.id}"></h:inputHidden>
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{role.name}" />
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{role.name}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>
			<p:column headerText="编号">
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{role.code}" />
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{role.code}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>
			<p:column headerText="备注">
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{role.remark}" />
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{role.remark}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>
			<p:column headerText="编辑" style="width:32px">
				<p:rowEditor />
			</p:column>
		</p:dataTable>
	</h:form>
</h:body>
</html>